//
//  APPAlertViewController.swift
//  APP
//
//  Created by Rdxer on 2017/12/20.
//  Copyright © 2017年 Rdxer. All rights reserved.
//

import UIKit
import Spring
import XXLogger



/// Normal Style  三行
open class APHAlertViewController: APHTipAlertViewController {
    
    var titleHeight:CGFloat = 50
    
    
    open var title_Label = UILabel.init().then {
        $0.font = 17.toFont
        $0.textAlignment = .center
        $0.numberOfLines = 0
        $0.xx_Add(divider: .bottom, dividerColor: AppColor.backgroundColor, dividerWidth: 1, dividerEdgeInset: UIEdgeInsets.zero)
    }
    
    open override func prepareSubViews(){
        view.addSubviews([
            backView,
            containerView.addSubviews([
                title_Label,
                message_Label,
                buttonsContainerView.addSubviews([
                    cancelButton,
                    confirmButton
                    ])
                ])
            ])
    }
    
    open override func layoutSubViews(){
        
        backView.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
        }
        
        containerView.snp.makeConstraints { (make) in
            make.center.equalToSuperview()
            make.width.equalTo(w)
        }
        
        title_Label.snp.makeConstraints { (make) in
            make.top.left.right.equalToSuperview()
            make.height.equalTo(titleHeight)
        }
        
        buttonsContainerView.snp.makeConstraints { (make) in
            make.bottom.left.right.equalToSuperview()
            make.height.equalTo(rowHeight)
        }
        
        message_Label.snp.makeConstraints { (make) in
            make.top.equalTo(title_Label.snp.bottom).offset(margin)
            make.bottom.equalTo(buttonsContainerView.snp.top).offset(-margin)
            make.left.equalToSuperview().offset(margin)
            make.right.equalToSuperview().offset(-margin)
        }
        
        buttonsContainerView.xx_HorizontalTile(withSubviews: [cancelButton,confirmButton], insets: .zero)
    }
}
